<extend name="Layout/base" />
<block name="css">
	<style>
		.el-main {
			padding: 0;
			margin: 20px;
			background: #fff;
			padding: 20px;
		}
		.objectbox {
			margin-top: 10px;
		}
		.object {
			display: flex;
			flex-wrap: wrap;
		}
		.objectname {
			border: 1px solid #f3f3f3;
			font-size: 14px;
			width: 130px;
			height: 30px;
			text-align: center;
			line-height: 30px;
			margin-right: 16px;
			margin-top: 16px;
		}
		.select {
			text-align: right;
			margin-top: 10px;
		}
		.table {
			margin-top: 20px;
			border: 1px solid #ccc;
		}
		.pagenation {
			text-align: center;
			margin-top: 40px;
		}
		#elcontain::-webkit-scrollbar {
			display: none;
		}
		.el-input--suffix {
			width: 200px;
			margin-right: 20px;
		}
		.pagetitle {
			font-size: 20px;
			border-bottom:  1px solid #ccc;
			color: #409EFF;
			padding-bottom: 12px;
		}
	</style>
</block>
<block name="content">
	<div class="pagetitle">历史订单</div>
	<div class="objectbox">
		<div class="select">
			<el-input size="small" placeholder="请输入内容" @keyup.enter.native="changeParam" v-model="param.key">
				<i slot="suffix" class="el-input__icon el-icon-search"></i>
			</el-input>
		</div>
		<div class="table">
			<el-table :data="tableData" height="250" style="width: 100%" :cell-style= "{ 'text-align': 'center'}" :header-cell-style="{ 'text-align':'center'}">
				<el-table-column prop="order_no" label="订单编号"></el-table-column>
				<el-table-column prop="store_name" label="公司简称"></el-table-column>
				<el-table-column prop="audit_name" label="审核员"></el-table-column>
				<el-table-column prop="activity_name" label="活动名称"></el-table-column>
				<el-table-column prop="manager_name" label="客戶"></el-table-column>
				<el-table-column prop="order_status" label="状态">
					<template slot-scope="scope">
						<span v-if="scope.row.order_status == '0'">待店长下单</span>
						<span v-if="scope.row.order_status == '1'">待审核</span>
						<span v-if="scope.row.order_status == '2'">审核未通过</span>
						<span v-if="scope.row.order_status == '3'">进行中</span>
						<span v-if="scope.row.order_status == '4'">上画待验收</span>
						<span v-if="scope.row.order_status == '5'">上画验收完成</span>
						<span v-if="scope.row.order_status == '6'">下画待验收</span>
						<span v-if="scope.row.order_status == '7'">订单完成</span>
						<span v-if="scope.row.order_status == '11'">高空物料待报价</span>
						<span v-if="scope.row.order_status == '12'">高空物料报价待审核</span>
						<span v-if="scope.row.order_status == '13'">高空报价审核失败</span>
					</template>
				</el-table-column>
				<el-table-column prop="charger" label="项目负责人"></el-table-column>
				<el-table-column prop="partner_name" label="城市合伙人"></el-table-column>
				<el-table-column prop="option" label="操作">
					<template slot-scope="scope">
						<span style="border: 1px solid #ccc;color: #409EFF;padding:0px 10px;border-radius: 3px;display: inline-block;" @click="toDetail(scope.row.order_no)">查看</span>
					</template>
				</el-table-column>
			</el-table>
		</div>
		<div class="pagenation">
			<el-pagination background layout="prev, pager, next" @size-change="handleSizeChange"
						   @current-change="handleCurrentChange" :page-size="param.size" :total="total"></el-pagination>
		</div>
	</div>
</block>
<block name="js">
	<script>
        new Vue({
            el: '#app',
            data: function() {
                return {
                    tableData: [
                        {
                            orderno: '201904102145',
                            name: '哈根达斯',
                            checker: "啊啊啊",
                            activity: "节日促销",
                            client: "海岸城店",
                            status: "进行中",
                            charger: "哈哈哈哈",
                            partner: "Damon",
                            option: "查看",
                            type: 1
                        },
                        {
                            orderno: '201904102146',
                            name: '哈根达斯',
                            checker: "啊啊啊",
                            activity: "节日促销",
                            client: "海岸城店",
                            status: "待报价",
                            charger: "哈哈哈哈",
                            partner: "Damon",
                            option: "查看",
                            type: 2
                        },
                        {
                            orderno: '201904102147',
                            name: '哈根达斯',
                            checker: "啊啊啊",
                            activity: "节日促销",
                            client: "海岸城店",
                            status: "进行中",
                            charger: "哈哈哈哈",
                            partner: "Damon",
                            option: "查看",
                            type: 1
                        },
                        {
                            orderno: '201904102148',
                            name: '哈根达斯',
                            checker: "啊啊啊",
                            activity: "节日促销",
                            client: "海岸城店",
                            status: "待报价",
                            charger: "哈哈哈哈",
                            partner: "Damon",
                            option: "查看",
                            type: 2
                        }
                    ],
                    param: {
                        order_status: '7',
                        key: '',
                        page: 1,
                        size: 10
                    },
                    total: 0,
                }
            },
            created: function () {
                this.getData();
            },
            methods: {
                getData: function () {
                    var _this = this;
                    $.post(HOME_URL + '/orderAdmin/Order/getData', _this.param, function (data) {
                        if(data.status){
                            _this.total = parseInt(data.data.count);
                            _this.tableData = data.data.data;
                        }else{
                            _this.$message.error(data.msg);
                        }
                    }, 'json');
                },
                handleSizeChange: function (size) {
                    this.param.size = size;
                    this.getData();
                },
                handleCurrentChange: function (page) {
                    this.param.page = page;
                    this.getData();
                },
                changeParam: function () {
                    this.param.page = 1;
                    this.getData();
                },
                toDetail(order_no) {
                    window.location.href = HOME_URL + "/orderAdmin/Order/detail?order_no=" + order_no
                }
            }
        })
	</script>
</block>